package dlally.model;

import junit.framework.TestCase;

public class testLine extends TestCase {
	
	Line myLine;

	protected void setUp() throws Exception {
		super.setUp();
		myLine = new Line(0);
	}

	protected void tearDown() throws Exception {
		super.tearDown();
	}
	
	
	public void testEmptyLine(){
		assertEquals(myLine.nextEdge(20), null);
	}
	
	public void testNext(){
		Edge edge1 = new Edge(0, 1, 10);
		Edge edge2 = new Edge(0, 1, 100);
		myLine.addEdgeInOrder(edge2);
		//System.out.println("Checking " + myLine.nextEdge(5) + " against " + edge1);
		assertEquals(myLine.nextEdge(5), edge2);
		//System.out.println("Checking " + myLine.nextEdge(15) + " against " + null);
		assertEquals(myLine.nextEdge(150), null);
		myLine.addEdgeInOrder(edge1);
		//System.out.println("Checking " + myLine.nextEdge(5) + " against " + edge1);
		assertEquals(myLine.nextEdge(5), edge1);
		//System.out.println("Checking " + myLine.nextEdge(15) + " against " + edge2);
		assertEquals(myLine.nextEdge(15), edge2);
		//System.out.println("Checking " + myLine.nextEdge(200) + " against " + null);
		assertEquals(myLine.nextEdge(200), null);
	}
	
	public void testSetGet(){
		assertEquals(myLine.getChoice(),"");
		assertEquals(myLine.getPosition(), 0);
		myLine.setChoice("testName");
		assertEquals(myLine.getChoice(), "testName");
	}

}
